﻿using System;
using System.Linq;
namespace d2
{
    class Program
    {
        static void Main(string[] args)
        {
            Random rand = new Random();
            int[] nums;
            nums = new int[100];
            for(int i = 0; i < 100; i++)
            {
                nums[i] = rand.Next(0, 1000);
                //Console.WriteLine(nums[i]);
            }
            var m = from n in nums orderby n descending select n;
            double sum = 0;
            foreach(var n in m)
            {
                sum += n;
                Console.WriteLine(n);
            }
            double average = sum / 100;
            Console.WriteLine("100个数的和为:{0}", sum);
            Console.WriteLine("100个数的平均数为:{0}", average);
            //Console.WriteLine(sum);
            //Console.WriteLine(average);
        }
    }
}
